package com.netas.kekmanager.dao.model;

import com.netas.kekmanager.dao.*;
import com.netas.kekmanager.dao.factory.*;
import com.netas.kekmanager.dao.exceptions.*;
import java.io.Serializable;
import java.util.*;

public class User implements Serializable
{
	/** 
	 * This attribute maps to the column id in the user table.
	 */
	protected int id;

	/** 
	 * This attribute maps to the column username in the user table.
	 */
	protected String username;

	/** 
	 * This attribute maps to the column name in the user table.
	 */
	protected String name;

	/** 
	 * This attribute maps to the column email in the user table.
	 */
	protected String email;

	/** 
	 * This attribute maps to the column password in the user table.
	 */
	protected String password;

	/** 
	 * This attribute maps to the column user_type_id in the user table.
	 */
	protected int userTypeId;
        
        protected Date registerDate;
        
        protected Double averageRating;

	/**
	 * Method 'User'
	 * 
	 */
	public User()
	{
	}

    public Double getAverageRating() {
        return averageRating;
    }

    public void setAverageRating(Double averageRating) {
        this.averageRating = averageRating;
    }

	/**
	 * Method 'getId'
	 * 
	 * @return int
	 */
	public int getId()
	{
		return id;
	}

	/**
	 * Method 'setId'
	 * 
	 * @param id
	 */
	public void setId(int id)
	{
		this.id = id;
	}

	/**
	 * Method 'getUsername'
	 * 
	 * @return String
	 */
	public String getUsername()
	{
		return username;
	}

	/**
	 * Method 'setUsername'
	 * 
	 * @param username
	 */
	public void setUsername(String username)
	{
		this.username = username;
	}

	/**
	 * Method 'getName'
	 * 
	 * @return String
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * Method 'setName'
	 * 
	 * @param name
	 */
	public void setName(String name)
	{
		this.name = name;
	}

	/**
	 * Method 'getEmail'
	 * 
	 * @return String
	 */
	public String getEmail()
	{
		return email;
	}

	/**
	 * Method 'setEmail'
	 * 
	 * @param email
	 */
	public void setEmail(String email)
	{
		this.email = email;
	}

	/**
	 * Method 'getPassword'
	 * 
	 * @return String
	 */
	public String getPassword()
	{
		return password;
	}

	/**
	 * Method 'setPassword'
	 * 
	 * @param password
	 */
	public void setPassword(String password)
	{
		this.password = password;
	}

	/**
	 * Method 'getUserTypeId'
	 * 
	 * @return int
	 */
	public int getUserTypeId()
	{
		return userTypeId;
	}

	/**
	 * Method 'setUserTypeId'
	 * 
	 * @param userTypeId
	 */
	public void setUserTypeId(int userTypeId)
	{
		this.userTypeId = userTypeId;
	}

	/**
	 * Method 'equals'
	 * 
	 * @param _other
	 * @return boolean
	 */
	public boolean equals(Object _other)
	{
		if (_other == null) {
			return false;
		}
		
		if (_other == this) {
			return true;
		}
		
		if (!(_other instanceof User)) {
			return false;
		}
		
		final User _cast = (User) _other;
		if (id != _cast.id) {
			return false;
		}
		
		if (username == null ? _cast.username != username : !username.equals( _cast.username )) {
			return false;
		}
		
		if (name == null ? _cast.name != name : !name.equals( _cast.name )) {
			return false;
		}
		
		if (email == null ? _cast.email != email : !email.equals( _cast.email )) {
			return false;
		}
		
		if (password == null ? _cast.password != password : !password.equals( _cast.password )) {
			return false;
		}
		
		if (userTypeId != _cast.userTypeId) {
			return false;
		}
		
		return true;
	}

	/**
	 * Method 'hashCode'
	 * 
	 * @return int
	 */
	public int hashCode()
	{
		int _hashCode = 0;
		_hashCode = 29 * _hashCode + id;
		if (username != null) {
			_hashCode = 29 * _hashCode + username.hashCode();
		}
		
		if (name != null) {
			_hashCode = 29 * _hashCode + name.hashCode();
		}
		
		if (email != null) {
			_hashCode = 29 * _hashCode + email.hashCode();
		}
		
		if (password != null) {
			_hashCode = 29 * _hashCode + password.hashCode();
		}
		
		_hashCode = 29 * _hashCode + userTypeId;
		return _hashCode;
	}

	/**
	 * Method 'createPk'
	 * 
	 * @return UserPk
	 */
	public UserPk createPk()
	{
		return new UserPk(id);
	}

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
        
        

	/**
	 * Method 'toString'
	 * 
	 * @return String
	 */
	public String toString()
	{
		StringBuffer ret = new StringBuffer();
		ret.append( "com.netas.kekmanager.dao.dto.User: " );
		ret.append( "id=" + id );
		ret.append( ", username=" + username );
		ret.append( ", name=" + name );
		ret.append( ", email=" + email );
		ret.append( ", password=" + password );
		ret.append( ", userTypeId=" + userTypeId );
		return ret.toString();
	}

}
